package com.springboot.astra.service.serviceImpl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.springboot.astra.bean.Permission;
import com.springboot.astra.bean.Resource;
import com.springboot.astra.bean.Role;
import com.springboot.astra.mapper.RolesMapper;
import com.springboot.astra.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class RoleServiceImpl implements RoleService {
    @Autowired
    RolesMapper rolesMapper;
    @Override
    public Role getOneById(Integer id) {
        return rolesMapper.getOneById(id);
    }

    @Override
    public Role getOneByResource(Integer id) {
        return rolesMapper.getOneByResource(id);
    }

    @Override
    public List<Role> getAll() {
        return rolesMapper.getAll();
    }

    @Override
    public List<Permission> getPermission(Integer id) {
        return rolesMapper.getPermission(id);
    }

    @Override
    public List<Resource> getResource(Integer id) {
        return rolesMapper.getResource(id);
    }

    @Override
    public IPage<Role> selectPageVo(Page<Role> page) {
        return rolesMapper.selectPageVo(page);
    }

    @Override
    public void insertRole(Role role) {
        rolesMapper.insertRole(role);
    }

    @Override
    public void updateOneById(Role role) {
        rolesMapper.updateOneById(role);
    }

    @Override
    public void deleteOneById(Integer id) {
        rolesMapper.deleteOneById(id);
    }

    @Override
    public List<Role> getOnlyRoles() {
        return rolesMapper.getOnlyRoles();
    }
}
